<!DOCTYPE html>
<html  lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>点单信息</title>
    <th:block th:include="~{common/common::commonHead}"/>
    <script th:src="@{/js/order/prisonerOrderList.js}"></script>
</head>
<!-- /Head -->
<!-- Body -->
<body>
<!-- Page Body -->
<div class="page-body">
    <div class="panel panel-primary">
        <div class="panel-heading bg-blue">
            点单信息
        </div>
        <div class="widget-body grid-table">
            <div class="toolbar">
                <div class="toolbar-right">
                    <div class="fl-right">
                        <div class="btn-group" role="group">
                            <button data-click="toggleFilter()" class="btn btn-default text-center">
                                <i class="fa fa-filter fa-fw"></i>
                            </button>
                            <button data-click="refresh('historyPrisonerOrderList')" class="btn btn-default">
                                <i class="fa fa-refresh fa-fw"></i>
                            </button>
                            <button data-click="download('historyPrisonerOrderList')" class="btn btn-default">
                                <i class="fa fa-download fa-fw"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            <div id="historyPrisonerOrderList"></div>
            <form class="filter search-content form-horizontal" data-width="650" role="form">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="col-xs-4 control-label"> 单号 </label>
                        <div class="col-xs-8">
                            <div class="iconic-input right">
                                <input name="id" type="text" class="form-control spinner"
                                       placeholder="请输入点单号码">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="col-xs-4 control-label"> 犯人姓名 </label>
                        <div class="col-xs-8">
                            <div class="iconic-input right">
                                <input name="prisonerName" type="text" class="form-control spinner"
                                       placeholder="请输入犯人姓名">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12">
                    <button type="button" data-click="hideFilter()" class="btn btn-default pull-right">取消</button>
                    <button type="button" data-click="submitFilter('historyPrisonerOrderList')" class="btn btn-blue pull-right">确定</button>
                </div>
            </form>
        </div><!-- end of panel -->
    </div>
</div>
</body>
<!--  /Body -->
</html>
<script>
    $(function () {
        var gridTable = $("#historyPrisonerOrderList").gridTable({
            url: "orderPrisoner/pageOrderPrisonerHis",
            columns: [
                {title: "订单号", field: "id"},
                {title: "犯人姓名", field: "prisonerName"},
                {title: "监区", field: "area"},
                {title: "状态", field: "status",format:toStatus},
                {title: "已发数量", field: "totalInvoice",dataType:"number"},
                {title: "商品总数量", field: "totalCount",dataType:"number"},
                {title: "订单总额", field: "totalMoney",dataType:"decimal"},
                {title: "创建时间", field: "createTime"}
            ],
            idField: "id",
            infoUrl: "order/prisonerOrderInfo.html",
            controls:{
                edit:{
                    show: false
                },
                del:{
                    show:false
                }
            },
            onDoubleClickRow: function (row, e) { // 行双击事件回调
                var target = e.target;
                if ($(target).closest("td.row-control").length !== 0) {
                    return true;
                }

                var param = {};
                param['id'] = row.getData()['id'];
                $.openIframeDialog({
                    url: "order/prisonerOrderInfo.html",
                    param: param,
                    onOpen: function () {
                        row.getElement().addClass("warning");
                    },
                    onClose: function () {
                        row.getElement().removeClass("warning");
                        gridTable.reloadData();
                    },
                    buttons: {
                        ok: {show: false},
                        cancel: {show: false}
                    }
                });

            }
        })
    });
    function toStatus(status){
        switch (status) {
            case '2':
                return "<span class='label label-orange'>已审核</span>";
            case '1':
                return "<span class='label label-default'>待审核</span>";
            case '4':
                return "<span class='label label-yellow'>配送中</span>";
            case '5':
                return "<span class='label label-warning'>部分收货</span>";
            case '9':
                return "<span class='label label-success'>待全部收货</span>";
            case '10':
                return "<span class='label label-danger'>已收货</span>";
            case '99':
                return "<span class='label label-danger'>审核失败</span>";
            default:
                return status;
        }
    }
</script>